<template>
  <!--交卷提示窗口-->
  <view class="SubmitAnswerConfirm">
    <u-popup :show="isPopup" :round="15" mode="bottom" @close="onClose" safe-area-inset-bottom>
      <view class="title">练习密钥</view>
      <view class="info flex flex-column item-center">
        <image style="width: 421rpx;height: 320rpx" src="https://qiniu-bjjrzy.bjjrzy.com/bjupi/practice/cognPractice/submit.svg"></image>
        <view style="margin-top: 40rpx;">您确认要提交试卷吗？</view>
        <view style="margin-top: 40rpx;font-size: 14px;color: #999999;">
          为防止您误触交卷按钮，交卷时将会有3次确认弹窗,本弹窗为第{{ submitNum }}次弹窗（{{ submitNum }}/3）
        </view>
      </view>
      <view class="footer">
        <view class="confirm btn" @click="confirm">确定</view>
        <view class="line"></view>
        <view class="close btn" @click="onClose">取消</view>
      </view>
    </u-popup>
  </view>
</template>
<script>
export default {
  name: "SubmitAnswerConfirm",
  data() {
    return {
      isPopup: false,
      submitNum: 1,
    }
  },
  methods: {
    onClose() {
      this.isPopup = false;
      this.$emit("close")
    },
    async open() {
      this.submitNum = 1
      this.isPopup = true;
    },
    confirm() {
      if (this.submitNum >= 3) {
        this.$emit("confirm", true);
        this.isPopup = false;
      }
      this.submitNum++
    },
  }
}
</script>
<style scoped lang="scss">
.SubmitAnswerConfirm {
  .title {
    color: #333333;
    font-size: 32rpx;
    font-weight: bold;
    text-align: center;
    height: 75px;
    line-height: 75px;
  }

  .info {
    padding: 0 18px;
  }

  .btn {
    height: 74px;
    text-align: center;
    line-height: 74px;
    color: #000000;
    font-size: 14px;
  }

  .line {
    width: 100%;
    background-color: #F2F2F2;
    height: 6rpx;
  }
}
</style>